<?php
include("connection.php"); 
$q=$_GET["q"];

$query = "SELECT region_name as caption , region_code as value from region WHERE (region_name LIKE '%$q%' OR region_code LIKE '$q') LIMIT 0,10";
$arr = array();
$rs = mysql_query($query);

while($obj = mysql_fetch_array($rs))
{
    $arr[] = $obj;
}

echo json_encode($arr);
mysql_close($con);
?>
 